<?php

session_start();

if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {

    header("Location: login.php");
}
include 'i_functions.php';
//
$_SESSION['DataType'] = "";
$_SESSION['Trace'] = "";
//
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $SourceID = $_POST['SourceID'];

    $user_name = "root";
    $pass_word = "haddons";
    $database = "PPI";
    $server = "127.0.0.1";

    $db_handle = mysql_connect($server, $user_name, $pass_word);
    $db_found = mysql_select_db($database, $db_handle);

    if ($db_found) {
//$q_SourceID = quote_smart($SourceID . "%", $db_handle);
//$q_sname = quote_smart($sname . "%", $db_handle);
        $csvFile = "ClientClaims"; //this can be used to override default cols
        $Options = array();
        $Options['Name'] = "claims";
        $Options['TableOpts'] = "Align=\"center\"";
        $Options["Filter"] = "SourceID = '" . $SourceID . "'";
        $Options['Action'] = "./ClaimEnq.php?ClaimID=";
        //$Options['AllowNew'] = "Y";
        $Columns = array("ID", "SourceID", "ClientID", "LenderName", "LoanType", "LoanStartDate", "LoanAmount", "LoanDuration", "Status"); //default cols
        $Result = BuildDataArray("claims", $csvFile, $Columns, $Options);
        $HTML_F = Array2Table($xData, $Columns, $Options);
        print $HTML_F;
    } else {
        $errorMessage = "Error logging on";
    }

    mysql_close($db_handle);
} else {

    include 'i_head.php';
    include 'i_ClaimSearch.html';
    include 'i_foot.html';
}
?>
